package ${packageName}.mvp.ui.base;

import android.os.Bundle;

import ${packageName}.event.BusEvent;
import ${packageName}.event.BusProvider;
import com.jpxx.base.ui.mvp.IPresenter;
import com.jpxx.base.ui.mvp.base.IBaseActivity;

import org.greenrobot.eventbus.Subscribe;

public abstract class BaseActivity<P extends IPresenter> extends IBaseActivity<P> {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        if(!BusProvider.getInstance().isRegistered(this)){
            BusProvider.getInstance().register(this);
        }
        super.onCreate(savedInstanceState);
    }

    @Subscribe
    public void onEmptyEvent(BusEvent emptyEvent){

    }

    @Override
    protected void onDestroy() {
        BusProvider.getInstance().unregister(this);
        super.onDestroy();
    }
}
